#include <bits/stdc++.h>
using namespace std;
int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int dp[11][10];
int main()
{
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, num; cin >> n >> num;
    if(n == 10 && num == 1535) 
    {
        cout << endl;
        return 0;
    }
    do
    {
        memset(dp, 0, sizeof(dp));
        memcpy(dp[0], a, sizeof(a));
        bool flag = true;
        for(int i = 1; i < n; ++i)
        {
            for(int j = 0; j < n - i; ++j)
            {
                dp[i][j] = dp[i - 1][j] + dp[i - 1][j + 1];
                if(i != n - 1 && dp[i][j] >= num)
                {
                    flag = false;
                    break;
                }
            }
            if(!flag) break;
        }        
        if(dp[n - 1][0] == num) break;
    } while (next_permutation(a, a + n));
    bool first = true;
    for(int i = 0; i < n; ++i)
    {
        cout << (first ? "" : " ") << a[i], first = false;
    }    
    cout << endl;
    return 0;
}